package rad.framework.mda.generator.template.main.resources.metainf;

import rad.framework.mda.generator.util.*;

public class PersistenceDD
{
  protected static String nl;
  public static synchronized PersistenceDD create(String lineSeparator)
  {
    nl = lineSeparator;
    PersistenceDD result = new PersistenceDD();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + NL + "<persistence xmlns=\"http://java.sun.com/xml/ns/persistence\" " + NL + "             xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + NL + "             xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd\" " + NL + "             version=\"1.0\">" + NL + "\t<persistence-unit name=\"";
  protected final String TEXT_2 = "\">" + NL + "\t\t<provider>org.hibernate.ejb.HibernatePersistence</provider>" + NL + "\t\t<jta-data-source>java:/DefaultDS</jta-data-source>" + NL + "\t\t<mapping-file>META-INF/orm.xml</mapping-file>" + NL + "      " + NL + "\t\t<properties>" + NL + "\t\t\t<property name=\"jboss.entity.manager.factory.jndi.name\" value=\"java:/";
  protected final String TEXT_3 = "\"/>" + NL + "\t\t\t<property name=\"hibernate.ejb.naming_strategy\" value=\"org.hibernate.cfg.DefaultComponentSafeNamingStrategy\"/>" + NL + "" + NL + "\t\t\t<!-- Hibernate Search -->" + NL + "\t\t\t<property name=\"hibernate.search.default.directory_provider\" value=\"org.hibernate.search.store.FSDirectoryProvider\" /> " + NL + "      " + NL + "\t\t\t<!--" + NL + "\t\t\tit is best to control these in ejb3.deployer/META-INF/persistence.properties and src/test/resources/default.persistence.properties" + NL + "      " + NL + "\t\t\t<property name=\"hibernate.ejb.naming_strategy\" value=\"rad.framework.hibernate.NamingStrategy\"/>" + NL + "\t\t\t<property name=\"hibernate.cache.provider_class\" value=\"org.jboss.ejb3.entity.TreeCacheProviderHook\"/>" + NL + "\t\t\t<property name=\"hibernate.treecache.mbean.object_name\" value=\"jboss.cache:service=EJB3EntityTreeCache\"/>" + NL + "\t\t\t<property name=\"hibernate.cache.use_query_cache\" value=\"true\"/> " + NL + "" + NL + "\t\t\t<property name=\"hibernate.dialect\" value=\"org.hibernate.dialect.HSQLDialect\"/>" + NL + "\t\t\t<property name=\"hibernate.transaction.manager_lookup_class\" value=\"org.hibernate.transaction.JBossTransactionManagerLookup\"/>" + NL + "\t\t\t<property name=\"hibernate.transaction.flush_before_completion\" value=\"true\"/>" + NL + "\t\t\t<property name=\"hibernate.hbm2ddl.auto\" value=\"update\"/>" + NL + "\t\t\t<property name=\"hibernate.show_sql\" value=\"true\"/>" + NL + "\t\t\t<property name=\"hibernate.jdbc.batch_size\" value=\"0\"/>" + NL + "\t\t\t-->" + NL + "\t\t</properties>" + NL + "\t</persistence-unit>" + NL + "</persistence>";
  protected final String TEXT_4 = NL;

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    

    org.eclipse.uml2.uml.Model uml2Model = (org.eclipse.uml2.uml.Model) argument;
    stringBuffer.append(TEXT_1);
    stringBuffer.append(uml2Model.getName());
    stringBuffer.append(TEXT_2);
    stringBuffer.append(uml2Model.getName());
    stringBuffer.append(TEXT_3);
    stringBuffer.append(TEXT_4);
    return stringBuffer.toString();
  }
}
